home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / Developer University / DUProjects / DataSave / Sources / Pizza.cpp < prev    next >
Encoding:
Text File  |  1996-03-05  |  1.9 KB  |  78 lines  |  [TEXT/CWIE]

  1. //    Copyright © 1995-96 Apple Computer, Inc. All rights reserved.
  2. //    Release Version:    $ ODF 1 $
  3.  
  4. //==========================================================================
  5. #ifndef PIZZA_H
  6. #include "Pizza.h"                //  CPizza
  7. #endif
  8.  
  9. #ifndef FWBARRAY_H
  10. #include "FWBArray.h"
  11. #endif
  12.  
  13. // ----- OSLayer Includes -----
  14. #ifndef FWOVLSHP_H
  15. #include "FWOvlShp.h"            // FW_COvalShape
  16. #endif
  17.  
  18. //=== RunTime Info ========================================================
  19. FW_DEFINE_CLASS_M0(CPizza)
  20.  
  21. const FW_ClassTypeConstant LPizza = FW_TYPE_CONSTANT('p','i','z','a');
  22. FW_REGISTER_ARCHIVABLE_CLASS(LPizza, CPizza, CPizza::Read, 0, 0, CPizza::Write)
  23.  
  24. //==========================================================================
  25. CPizza::CPizza(FW_CRect bounds)
  26.  :    fBounds(bounds)
  27. {
  28. }
  29.  
  30. //--------------------------------------------------------------------------
  31. CPizza::~CPizza()
  32. {
  33. }
  34.  
  35. //--------------------------------------------------------------------------
  36. void    
  37. CPizza::Draw(FW_CGraphicContext& gc)
  38. {
  39.     FW_COvalShape::RenderOval(gc, fBounds, FW_kFill, FW_kRGBYellow);
  40.     FW_COvalShape::RenderOval(gc, fBounds, FW_kFrame);
  41. }
  42.  
  43. //--------------------------------------------------------------------------
  44. FW_CRect    
  45. CPizza::GetBounds()
  46. {
  47.     return fBounds;
  48. }
  49.  
  50. //--------------------------------------------------------------------------
  51. void 
  52. CPizza::Write(FW_CWritableStream& stream, FW_ClassTypeConstant type, const void *object)
  53. {
  54.     FW_UNUSED(type);
  55.      ((CPizza*)object)->Flatten(stream);
  56. }
  57.  
  58. //--------------------------------------------------------------------------
  59. void
  60. CPizza::Flatten(FW_CWritableStream& stream)
  61. {    
  62.     stream << fBounds;
  63. }
  64.  
  65. //--------------------------------------------------------------------------
  66. void* 
  67. CPizza::Read(FW_CReadableStream& stream, FW_ClassTypeConstant type)
  68. {
  69.     FW_UNUSED(type);
  70.     return new CPizza(stream);
  71. }
  72.  
  73. //--------------------------------------------------------------------------
  74. CPizza::CPizza(FW_CReadableStream& stream)
  75. {
  76.     stream >> fBounds;
  77. }
  78.